<?php

namespace Repository;

use Doctrine\ORM\EntityRepository;

class ImageRepository extends EntityRepository {
	public function total_rows($pag){
		$q = $this->_em->createQueryBuilder()
		                ->select('COUNT(u.id)')
		                ->from('Entity\ShImage','u');
		return $q->getQuery()->getSingleScalarResult();
	}
	
	public function backendPaginate($conf){
		$q = $this->_em->getRepository('\Entity\ShImage')->findBy(
			$conf['condition'], $conf['order'], $conf['limit'], $conf['offset']
		);
		
		return $q;
	}
}